home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr40 / x1j4_src.zip / TNTYP.H < prev    next >
Text File  |  1995-01-21  |  21KB  |  422 lines

  1. /**************************************************************************\
  2. *                                                                          *
  3. *                                                                          *
  4. *    *****                      *****                                      *
  5. *      *****                  *****                                        *
  6. *        *****              *****                                          *
  7. *          *****          *****                                            *
  8. *            *****      *****                                              *
  9. *              *****  *****                                                *
  10. *            *****      *****                                              *
  11. *          *****          *****          The Firmware. The Net.            *
  12. *        *****              *****        Portable. Compatible.             *
  13. *      *****                  *****      Public Domain.                    *
  14. *    *****                      *****    By NORD><LINK.                    *
  15. *                                                                          *
  16. *                                                                          *
  17. *                                                                          *
  18. *    TNTYP.H   -   Headerfile for definition of structures                 *
  19. *                                                                          *
  20. *    angelegt:      DC4OX                                                  *
  21. *    modifiziert:   G8KBB                                                  *
  22. *                                                                          *
  23. \**************************************************************************/
  24.  
  25. /*
  26.  * Released as TheNet X-1J, September 1993
  27.  */
  28.  
  29. /*
  30.  * Add optional support for TexNet on declaration of TEXNET
  31.  *
  32.  * Released as TheNet X-1J release 4, January 1995
  33.  */
  34.  
  35. typedef    unsigned uint;
  36.  
  37. /* typedef uint     BOOLEAN;  */      /* duplicates all.h */
  38.  
  39. typedef    struct    lhead {        /* Bufferkopf                     */
  40.     struct lhead *lnext;
  41.     struct lhead *lprev;
  42.     } lhtyp;
  43.  
  44. typedef    struct    l2lblk {    /* Level 2 Link Eintrag                 */
  45.     char    state;        /* Status                     */
  46.     char    srcid[7];    /* eigenes Call, Ident                 */
  47.     char    dstid[7];    /* Gegenstation                     */
  48.     char    viaid[8*7 +1];    /* Digipeaterliste zur Gegenstation         */
  49.     char    liport;        /* Port fuer Link                 */
  50.     char    VR;        /* receice sequence Variable             */
  51.     char    VS;        /* send sequence Variable             */
  52.     char    lrxNR;        /* last received NR                 */
  53.     char    ltxNR;        /* last transmitted NR                 */
  54.     char    tries;        /* aktuelle Versuche                 */
  55.     char    N2;        /* maximale Versuche                 */
  56.     char    k;        /* Fenstergroesse                 */
  57.     char    snglT1;        /* FRACK - ohne Digis                 */
  58.     char    V2link;        /* Protokoll Version                 */
  59.     char    RStype;        /* naechstes Antwortframe nach T2-Ablauf     */
  60.     char    frmr[3];    /* FRMR Info Bytes                 */
  61.     char    flag;        /* 5: L3, 6: busy, 7: DiscReq             */
  62.     uint    initT1;        /* T1 Wert fuer Initialisierung             */
  63.     uint    T1;        /* Timer 1                     */
  64.     uint    T2;        /* Timer 2                     */
  65.     uint    T3;        /* Timer 3                     */
  66.     uint    noatou;        /* no-activity-timeout                 */
  67.     uint    rcvd;        /* empfangene I Frames                 */
  68.     uint    tosend;        /* zu sendende I Frames                 */
  69.     lhtyp    rcvdil;        /* empfangene Info Liste             */
  70.     lhtyp    sendil;        /* zu sendende Info Liste             */
  71. #ifdef TEXNET
  72.     char    realid[7];    /* texnet real user id details               */
  73. #endif
  74.     } l2ltyp;
  75.  
  76. typedef    struct    mhead {        /* Message Buffer Header             */
  77.     lhtyp    link;        /* Link zu Nachbarn der Kette             */
  78.     lhtyp    msg;        /* Kopf der Message Liste             */
  79.     char    *nxtchr;    /* Pointer auf naechstes Zeichen         */
  80.     uint    putcnt;        /* eingeschriebene Zeichen             */
  81.     uint    getcnt;        /* ausgelesene Zeichen                 */
  82.     l2ltyp    *l2lnk;        /* Eintrag in LNKTBL                 */
  83.     char    usrtyp;        /* Usertyp, 0=Host, 2=Enduser, 4=Circuit     */
  84.     char    pid;        /* PID des Frames, VR-VS in Level 4         */
  85.     char    l2port;        /* Port, 0 = HDLC, 1 = RS232             */
  86.     char    morflg;        /* Frame besteht aus mehreren Teilen Flag    */
  87.     char    l4trie;        /* Versuche in Level4                 */
  88.     uint    l4time;        /* Timeout in Level4                 */
  89.     } mhtyp;
  90.  
  91. typedef    struct    usrblk {    /* User Kontroll Block                 */
  92.     struct usrblk *unext;    /* doppelt verkettete Liste             */
  93.     struct usrblk *uprev;
  94.     char    status;        
  95.                 /* 0=leer, 1=am CCP, 2=ConReq, 3=Passworteing*/
  96.                 /* 4=Talk,                                   */
  97.                 /* 5=Manage/login 6=Manage/passwd ok         */
  98.                 /* 7 = closedown pending                     */
  99.                 /* 8 reserved for operator/login             */
  100.                 /* 9 reserved for operator/password ok       */
  101.     l2ltyp    *cblk_u;    /* eigener Kontrollblock             */
  102.     char    typ_u;        /* eigener Typ                     */
  103.     l2ltyp    *cblk_p;    /* Partner Kontrollblock             */
  104.     char    typ_p;        /* Partner Typ                     */
  105.     char    sysflg;        /* SYSOP Flag                     */
  106.     char    errcnt;        /* CCP Fehlerzaehler                 */
  107.     char    paswrd[5];    /* gegebene Passwort Stellen             */
  108.     mhtyp    *mbhd;        /* eingelaufene Frames fuer User         */
  109.                 /* Rest noch undefiniert             */
  110.         } usrtyp;
  111.  
  112. typedef    struct hostus {      /* Kontrollblock fuer zum Host connecteten User */
  113.     char    conflg;        /* User ist connected Flag             */
  114.     char    call[6];    /* Call des Users                 */
  115.     char    ssid;        /* SSID des Users                 */
  116.     char    disflg;        /* Flag: Verbindung trennen, wenn Info weg   */
  117.     uint    noacti;        /* Timer fuer keine Aktivitaet             */
  118.     uint    noact2;        /* Timer2 fuer keine Aktivitaet             */
  119.     uint    inlin;        /* eingelaufene Zeilen                 */
  120.     uint    outlin;        /* auszugebende Zeilen                 */
  121.     uint    duh2;
  122.     lhtyp    inbuf;        /* Listenkopf Eingabebuffer             */
  123.     lhtyp    outbuf;        /* Listenkopf Ausgabebuffer             */
  124.     } hustyp;
  125.  
  126. typedef    struct    nbrent {    /* Nachbarliste                     */
  127.     lhtyp    nbrlnk;        /* Link innerhalb der Liste             */
  128.     char    nbrcal[7];    /* Call                         */
  129.     char    nbrdil[15];    /* Digipeater                     */
  130.     char    nbrpor;        /* Port                         */
  131.     char    pathqu;        /* Qualitaet des Weges                 */
  132.     char    locked;        /* Flag: Eintrag gesperrrt j-n             */
  133.     uint    nbrrou;        /* Wege ueber diesen Nachbarn             */
  134.     l2ltyp    *nbrl2l;    /* Querverweis zur Level2 Tabelle         */
  135.     } nbrtyp;
  136.  
  137. typedef    struct    ziel {
  138.     char    qualit;        /* Qualitaet                     */
  139.     char    obscnt;        /* Lebensdauer Zaehler                 */
  140.     nbrtyp    *nachba;    /* Nachbar                     */
  141.     } wegtyp;
  142.  
  143. typedef    struct    nodent {    /* Nodeliste                     */
  144.     lhtyp    nodlnk;        /* Link innerhalb der Liste             */
  145.     char    actrou;        /* aktive Wege zu diesem Ziel             */
  146.     char    nodide[6];    /* Ident dieses Zieles                 */
  147.     char    nodcal[7];    /* Call des Zieles                 */
  148.     char    wegnr;        /* Nummer des aktivens Weges             */
  149.     char    wege;        /* moegliche Wege                 */
  150.     wegtyp    weg[3];        /* Wegbeschreibungen                 */
  151.     lhtyp    nodinf;        /* Frames fuer dieses Ziel             */
  152.         } nodtyp;
  153.  
  154. typedef    struct    ptcent {    /* Patchcord Liste                 */
  155.     l2ltyp    *luserl;    /* Level2 Link des Users             */
  156.     char    lusert;        /* Typ des Users                 */
  157.         } ptctyp;        /* es gehoeren immer 2 Eintraege zusammen    */
  158.  
  159. typedef    struct    cirblk {    /* Level 3 Kontrollblock             */
  160.     char    state3;        /* Status: 0=leer, 1=ConReq, 2=Con, 3=DisReq */
  161.     char    idxpar;        /* Partner Index                 */
  162.     char    ideige;        /* eigener ID                     */
  163.     char    idpart;        /* Partner ID                     */
  164.     char    downca[7];    /* Downlink Call                 */
  165.     char    upcall[7];    /* Uplink Call                     */
  166.     char    window;        /* Fenstergroesse                 */
  167.     char    l4rxvs;        /* letzte bestaetigte Framenummer         */
  168.     char    l4vs;        /* letzte gesendete Framenummer             */
  169.     char    l4vr;        /* letzte erhaltene Framenummer             */
  170.     char    l4rs;        /* notwendige Antwort: 0=ACK, 1=NAK, 2=NAKweg*/
  171.     char    l4try;        /* Transport Versuche                 */
  172.     char    l4flag;        /* DISC-req, selbst choked, Partner choked   */
  173.     uint    traout;        /* Transport Timeout                 */
  174.     uint    acktim;        /* Acknowledge Timer                 */
  175.     uint    tranoa;        /* no-activity-Timeout                 */
  176.     uint    numrx;        /* empfangene Frames                 */
  177.     uint    numtx;        /* zu sendende Frames                 */
  178.     mhtyp   *fragme;    /* Fragment eines kommenden Frames         */
  179.     nodtyp    *l3node;    /* Node fuer diesen Circuit             */
  180.     lhtyp    mbhdrx;        /* Listenkopf empfangene Frames             */
  181.     lhtyp    mbhdtx;        /* Listenkopf zu sendende Frames         */
  182.     lhtyp    mbhdos;        /* Listenkopf: Frames ausserhalb der Folge   */
  183.     } cirtyp;
  184.  
  185. typedef    union cblk {        /* allgemeiner Kontrollblock             */
  186.     l2ltyp    l2blk;
  187.     cirtyp    l3blk;
  188.     hustyp    hoblk;
  189.         } ctyp;
  190.         
  191. typedef struct    param {        /* Parameter                     */
  192.   uint    *paradr;        /* Adresse des Parameters             */
  193.   uint    minimal;        /* Minimalwert                     */
  194.   uint    maximal;        /* Maximalwert                     */
  195.   } partyp;
  196.  
  197. typedef struct    comand {
  198.         char    *cmdstr;
  199.         uint    (*cmdfun)();
  200.         } cmdtyp;
  201.  
  202. #ifdef MONITORCMD
  203. typedef struct mheard
  204. {
  205.     struct mheard *nexthb;        /* Linked list pointers */
  206.     struct mheard *prevhb;
  207.     char call[7];            /* callsign of station heard */
  208.     unsigned lastheard;        /* timestamp for last heard time */
  209.     unsigned packets;        /* number of packets heard */
  210.     unsigned char isnode;        /* flag denotes if it is a node */
  211.     unsigned char istcpip;        /* flag denoted if it is tcp/ip */
  212. #ifdef METERS
  213.     unsigned char dev;        /* receiver deviation meter */
  214.     unsigned char sig_level;    /* rx signal level ( s-meter ) */
  215. #endif
  216.     char l3dest[7];            /* callsign of station heard */
  217. #ifdef TEXNET
  218.     unsigned char istexnet;        /* flag denoted if it is texnet */
  219. #endif
  220.     unsigned port;            /* port station heard on */
  221. } MHEARD;
  222. #endif
  223.  
  224. #ifdef ACL
  225. typedef struct aclentry_
  226. {
  227.     char call[7];            /* callsign of station in ACL */
  228.     unsigned char value;        /* ACL value for station */
  229. } ACLENTRY;
  230.  
  231. typedef struct aclmb
  232. {
  233.     struct aclmb *nextaclb;        /* linked list for ACL */
  234.     struct aclmb *prevaclb;
  235.     ACLENTRY entry[4];        /* set of 4 ACL entries in buffer */
  236. } ACLMB;
  237. #endif
  238.  
  239. /*--- Ende der Definitionen -------------------------------------------------*/
  240.  
  241. /* THE FOLLOWING ARE FROM L2x.C */
  242.  
  243.  
  244. typedef struct l_head         /* "list head", Listenkopf :                */
  245.   {
  246.     struct l_head   *head;    /*   Zeiger auf ersten Eintrag in Liste     */ 
  247.     struct l_head   *tail;    /*   Zeiger auf letzten Eintrag in Liste    */
  248.   } LHEAD;
  249.  
  250.  
  251. typedef struct lehead         /* "list entry head", Kopf eines Eintrags   */
  252.   {                           /* in Liste :                               */
  253.     struct lehead   *nextle;  /*   Zeiger auf naechsten Listeneintrag     */ 
  254.     struct lehead   *prevle;  /*   Zeiger auf vorherigen Listeneintrag    */
  255.   } LEHEAD;
  256.  
  257.  
  258. typedef struct lnkblk         /* "link block", fuer jeden Level-2-Link :  */
  259.   {
  260.     char     state;           /* Link-State, s.o. L2S...                  */
  261.     char     srcid[L2IDLEN];  /* "source id", eigenes Call/SSID oder      */
  262.                               /* Ident/SSID                               */
  263.     char     dstid[L2IDLEN];  /* "destination id", Call/SSID Gegenstation */
  264.     char     viaidl[L2VLEN+1];/* "via id list", Digipeaterstrecke,        */
  265.                               /* 0-terminiert, Weg zur Gegenstation       */
  266.     char     liport;          /* "link port" - 0 : HDLC, 1 : Crosslink    */
  267.     char     VR;              /* "receive sequence variable", Sequenz-    */
  268.                               /* nummer des naechsten zu empfangenden     */
  269.                               /* I-Frames                                 */
  270.     char     VS;              /* "send sequence variable", Sequenznummer  */
  271.                               /* des naechsten zu sendenden I-Frames      */
  272.     char     lrxdNR;          /* "last received N(R)", zuletzt            */
  273.                               /* empfangenes N(R) = eigene gesendete      */
  274.                               /* I-Frames bis lrxdNR-1 bestaetigt         */
  275.     char     ltxdNR;          /* "last transmitted N(R)", zuletzt         */
  276.                               /* gesendetes N(R) = empfangene I-Frames    */
  277.                               /* bis ltxdNR-1 bestaetigt                  */
  278.     char     tries;           /* aktuelle Anzahl Versuche (RETRY),        */
  279.                               /* hochzaehlend                             */
  280.     char     N2;              /* RETRY, maximale Anzahl Retries           */
  281.     char     k;               /* MAXFRAME, maximale Anzahl unbestaetigter */
  282.                               /* I-Frames                                 */
  283.     char     snglT1;          /* "single T1", T1 ohne Digikette = FRACK   */
  284.     char     V2link;          /* "version 2 link" - 0 : Version 1 Link    */
  285.                               /*                    1 : Version 2 Link    */
  286.     char     RStype;          /* "response supervisory frametype", nach   */
  287.                               /* T2-Ablauf zu sendendes Antwortframe      */
  288.                               /* (RR=0x01, RNR=0x05, REJ=0x09)            */
  289.     char     frmr[3];         /* die 3 FRMR-Infobytes, Sendung u. Empfang */
  290.                               /*   frmr[0] : zurueckgewies. Kontrollfeld  */
  291.                               /*   frmr[1] : V(R) CR V(S) 0               */
  292.                               /*   frmr[2] : 0000ZYXW                     */
  293.     char     flag;            /* Flag (s.o. L2F... )                      */
  294.                               /*   Bit 0 : nicht benutzt                  */
  295.                               /*   Bit 1 : nicht benutzt                  */
  296.                               /*   Bit 2 : nicht benutzt                  */
  297.                               /*   Bit 3 : nicht benutzt                  */
  298.                               /*   Bit 4 : nicht benutzt                  */
  299.                               /*   Bit 5 : 1 = Link ist Level 3 Link      */
  300.                               /*           (festgestellt anhand PID !)    */
  301.                               /*   Bit 6 : 1 = (eigenes) Device busy      */
  302.                               /*   Bit 7 : 1 = Link disconnecten, sobald  */
  303.                               /*           Sendeliste (sendil) leer ist   */
  304.     unsigned initT1;          /* "initial T1", (2 * Anzahl Digis + 1) *   */ 
  305.                               /* snglT1(= FRACK) * 100 in 1/100 sek       */
  306.     unsigned T1;              /* Timer 1, "frame acknowledge interval",   */
  307.                               /* Start :  initT1 + random(),              */
  308.                               /* 0 = inaktiv, 10 msec Downcounter         */
  309.     unsigned T2;              /* Timer T2, "response delay timer",        */
  310.                               /* 0 = inaktiv, 10 msec Downcounter         */
  311.     unsigned T3;              /* Timer T3, "inactive link timer",         */
  312.                               /* 0 = inaktiv, 10 msec Downcounter         */
  313.     unsigned noatou;          /* "no activity timeout",                   */
  314.                               /* nach Ablauf Link disconnecten,           */
  315.                               /* 0 = inaktiv, 1 sec Downcounter           */
  316.     unsigned rcvd;            /* "received", Anzahl empfangener I-Frames  */
  317.                               /* in rcvdil                                */
  318.     unsigned tosend;          /* Anzahl noch nicht gesendete oder         */
  319.                               /* unbestaetigte Frames in sendil           */
  320.     LHEAD    rcvdil;          /* "received info list", richtig            */
  321.                               /* empfangene I-Frames, mit Header/PID      */
  322.     LHEAD    sendil;          /* "send info list", zu sendende I-Frames,  */
  323.                               /* ohne Header/PID, nur Info                */
  324. #ifdef TEXNET
  325.     char     realid[L2IDLEN]; /* texnet real user id details              */
  326. #endif
  327.   } LNKBLK;
  328.  
  329.  
  330.  
  331. #ifdef FIRMWARE
  332.  
  333. typedef struct timebl              /* "time block", Zeit/Datums-Stamp :   */
  334.   {
  335.     char             second;       /*   Zeit :    Sekunde   (0..59)       */
  336.     char             minute;       /*             Minute    (0..59)       */
  337.     char             hour;         /*             Stunde    (0..23)       */
  338.     char             day;          /*   Datum :   Tag       (1..31)       */
  339.     char             month;        /*             Monat     (1..12)       */
  340.     char             year;         /*             Jahr      (0..99)       */
  341.   } TIMEBL;
  342.  
  343. #endif
  344.  
  345. /* ACHTUNG: mbhead muss genauso lang sein wie mb !                        */
  346.  
  347. typedef struct mbhead         /* "message buffer head",                   */
  348.   {                           /* Datenbuffer-Liste, Kopf :                */
  349.     struct mbhead   *nextmh;  /*   naechster Eintrag in Liste             */
  350.     struct mbhead   *prevmh;  /*   vorheriger Eintrag in Liste            */
  351.     LHEAD            mbl;     /*   "message buffer list", Zeiger auf      */
  352.                               /*   ersten Infobuffer dieser Message       */
  353.     char            *mbbp;    /*   "message buffer buffer pointer",       */
  354.                               /*   Zeiger auf aktuelles Zeichen in Buffer */
  355.     unsigned         mbpc;    /*   "message buffer put count",            */
  356.                               /*   Einschreibzaehler, aufwaertszaehlend   */
  357.     unsigned         mbgc;    /*   "message buffer get count",            */
  358.                               /*   Lesezaehler, aufwaertszaehlend         */
  359.     struct lnkblk   *l2link;  /*   Zeiger auf assozierten Linkblock       */
  360.     char             type;    /*   Typ des Buffers (User, Status)         */
  361.                               /*          L2M...                          */
  362.                               /*     oder MB...                           */
  363.                               /*     oder 0 User, 2 Level-2, 4 Level-4    */
  364.     char             l2fflg;  /*   Level 2 Frameflag / PID :              */
  365.                               /*     RX: PID                              */
  366.                               /*     TX: PID / s.o. T2FT1ST/T2FUS         */
  367.     char             l2port;  /*   0 = HDLC, 1 = RS232-Crosslink          */
  368.     char             morflg;  /*   "more follows flag" fuer Pakete, die   */
  369.                               /*   durch zusaetzlichen Netzwerkheader zu  */
  370.                               /*   lang wuerden und in 2 Frames           */
  371.                               /*   aufgetrennt wurden                     */
  372.                               /*     YES = das naechste Frame gehoert zu  */
  373.                               /*           diesem Paket                   */
  374.                               /*     NO  = sonst                          */
  375.     unsigned char   rxdev;    /* deviation meter reading for packet recvd */
  376.     unsigned char sig_level;  /* rx signal level ( s-meter )              */
  377. #ifdef FIRMWARE
  378.     char             rsvd[8];/*   (damit insgesamt Laenge wie mb)        */
  379.     TIMEBL           btime;   /*   Buffer-Time fuer Zeit/Datum-Stamps     */
  380. #else
  381.     char             rsvd[14];/*   (damit insgesamt Laenge wie mb)        */
  382. #endif
  383.  
  384.   } MBHEAD;
  385.  
  386.  
  387. /* ACHTUNG: mb muss genauso lang sein wie mbhead !                        */
  388.  
  389. typedef struct mb             /* "message buffer",                        */
  390.   {                           /* allgemeiner Datenbuffer :                */
  391.     struct mb *nextmb;        /*   naechster Eintrag in Liste             */
  392.     struct mb *prevmb;        /*   vorheriger Eintrag in Liste            */
  393.     char       data[32];      /*   Daten                                  */
  394.   } MB;
  395.  
  396.  
  397.  
  398. typedef struct stentry        /* "state table entry",                     */
  399.   {                           /* ein Eintrag in der State-Table :         */
  400.     VOID       (* func)();    /*   Zustandsuebergangsfunktion             */
  401.     char       newstate;      /*   neuer Zustand                          */
  402.   } STENTRY;
  403.  
  404.  
  405. #ifdef FIRMWARE
  406.  
  407. typedef struct heardb              /* "heard buffer", ein Eintrag         */
  408.   {                                /* in der Heardliste :                 */
  409.     struct heardb   *nexthb;       /*   Zeiger auf naechsten L.-Eintrag   */
  410.     struct heardb   *prevhb;       /*   Zeiger auf vorherigen L.-Eintrag  */
  411.     char             hid[L2IDLEN]; /*   ID der gehoerten Station          */
  412.     TIMEBL           hfirst;       /*   zuerst gehoert                    */
  413.     TIMEBL           hlast;        /*   zuletzt gehoert                   */
  414.     unsigned         hIno;         /*   Anzahl gehoerte I-Frames          */
  415.     unsigned         hRRno;        /*   Anzahl gehoerte RR-Frames         */
  416.     unsigned         hREJno;       /*   Anzahl gehoerte REJ-Frames        */
  417.     unsigned         hRNRno;       /*   Anzahl gehoerte RNR-Frames        */
  418.     char             hrsvd[5];     /*   (reserviert)                      */
  419.   } HEARDB;
  420.  
  421. #endif
  422.